package com.sopt.view;

import java.util.List;

import com.sopt.friends.R;
import com.sopt.friends.vo.FriendsPhone;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class GroupPhoneListAdapter extends BaseAdapter {
	
	private Context mContext;
	private List<FriendsPhone> mMemberList;
	private int mLayout;
	
	public GroupPhoneListAdapter(Context context, int layout, List<FriendsPhone> inputList) {
		mContext = context;
		mMemberList = inputList;
		mLayout = layout;
	}

	public int getCount() {
		return mMemberList.size();
	}

	public Object getItem(int position) {
		return mMemberList.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		FriendsPhone currentPhone = mMemberList.get(position);
		LayoutInflater inflate = LayoutInflater.from(mContext);
		
		View mCurrentView = inflate.inflate(mLayout, parent, false);
		
		TextView mTextView = (TextView)mCurrentView.findViewById(R.id.rowListPhoneNumber);
		
		if(mTextView!=null)mTextView.setText(currentPhone.getPhonenumber());
		Log.v("changdoc","are you here?");
		
		return mCurrentView;
	}

}
